package com.example.goodrubish.Garbage;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.goodrubish.R;

public class OnboardFragment extends Fragment {

    public static OnboardFragment newInstance(int imageResourceId) {
        OnboardFragment fragment = new OnboardFragment();
        Bundle args = new Bundle();
        args.putInt("imageResourceId", imageResourceId);
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_onboard, container, false);
        ImageView onboardImage = view.findViewById(R.id.onboard_image);

        if (getArguments() != null) {
            int imageResourceId = getArguments().getInt("imageResourceId", -1);
            if (imageResourceId != -1) {
                onboardImage.setImageResource(imageResourceId);
            }
        }
        return view;
    }
}